local GMCell = class("GMCell")
local UIUtil = require("utils.UIUtil")

function GMCell:ctor()
end

function GMCell:awake()
    self._textType = self._textType:GetComponent(typeof(CS.UnityEngine.UI.Text))
end

function GMCell:start()
    self._imageSelected:SetActive(false)
    local postEvent = self._panel:GetComponent(typeof(CS.GuidePostEvent))
    postEvent:SetCallback(handler(self, self._onPanelClick))
end

function GMCell:updateUI(data, index, selectedIndex)
    self._index = index
    self._textType.text = data.name
    self._imageSelected:SetActive(self._index == selectedIndex)
end

function GMCell:_onPanelClick(id, eventData)
    if id == 3 and self.customCallback then
        self.customCallback(self, self._index)
    end
end

return GMCell
